<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>修改随手拍作品 - {$config_sitename}</title>
    <link rel="stylesheet" href="__CSS__/global.css" />
    <link href="{$config_siteurl}static/js/artDialog/skins/default.css" rel="stylesheet" />
    <link rel="stylesheet" href="__CSS__/yf.css" />
    <link rel="stylesheet" type="text/css" href="__COMMJS__/yf_file/plupload/common.css" />
    <script type="text/javascript">
        //全局变量
        var GV = {
            siteUrl: "__ROOT__/",
            JS_ROOT: "__COMMJS__/"
        };
    </script>
    <script src="__COMMJS__/wind.js"></script>
    <script src="__JS__/jquery.min.js"></script>
</head>

<body>

<div class="b-page">
    <Admintemplate file="Home/Public/header"/>
    <div class="b-login">
        <div class="b-body l-center" style="padding-top:30px;">
            <div class="b-login__top">
                <a href="javascript:;" class="b-login__tab act">修改随手拍作品</a>
            </div>
            <div class="bake_body">
                <form name="form1" class="ajaxForm" action="__WEBURL__/user/bake/suipaiedit" method="post">
                    <div class="create">
                        <ul>
                            <li><input type="text" class="create_input" size="80" name="title" placeholder="点击添加作品名称" value="{$data.title}" /></li>
                            <li>作品主图(图片不能小于600*400px)</li>
                            <li class="mainpic yf-mainpic" style="width: 650px;">
                             	 <ul class="yf-mainpic-list">
                             	 <foreach name="data.all_pic" item="pic">
                             	 	<if condition="$key eq 0">
                            	 	<Form function="yf_image" parameter="image,image,$pic,works"/>
                            	 	</if>
                            	 	<if condition="$key neq 0">
                            	 	<li class="yf-img-move"><img src="{$pic}"><div class="yf-move-window yf-move-del"><span>删除</span></div><input type="hidden" name="all_pic[]" value="{$pic}"></li>
                            	 	</if>
                            	 </foreach>
                            	 	<Form function="yf_image_spe" parameter="image,image,'',works"/>
                            	 </ul>
                          	</li>
                            <li>简介</li>
                            <li><textarea name="content" cols="30" rows="15" class="create_ta">{$data.content}</textarea></li>
                            <li><button class="create_btn Ajax_submit_btn" >发布作品</button></li>
                            <li></li>
                        </ul>
                    </div>
                    <input type="hidden" name="id" value="{$data.id}"/>
                </form>

            </div>
        </div>
    </div>

    <Admintemplate file="Home/Public/footer"/>

</div>
<div class="up-img">
            
</div>
<script src="__JS__/index.js"></script>
<script src="__JS__/jquery.common.js"></script>
<script src="__JS__/jquery.form.min.js"></script>
<script src="__JS__/jquery.doajax.js"></script>

<script src="__COMMJS__/common.js"></script>
<script type="text/javascript" src="__COMMJS__/yf_upload/jquery.ui.widget.js"></script>
<script type="text/javascript" src="__COMMJS__/yf_upload/jquery.iframe-transport.js"></script>
<script type="text/javascript" src="__COMMJS__/yf_upload/jquery.fileupload.js"></script>
<script src="__COMMJS__/yf_file/plupload/plupload.full.min.js"></script>
<script src="__COMMJS__/yf_file/yf-file.js"></script>
<script>
	$(function(){
		var old_img = '';
		$('.yf-fileupload').fileupload({
 	    	dataType: 'json',
 	        add: function (e, data) {
 	        	old_img = $(this).parent().find('img').attr('src');
 	        	$(this).parent().find('.yf-move-window').hide();
 	 	        $(this).parent().find('img').attr('src', '/static/images/load2.gif');
 	            data.submit();
 	        },
 	        done: function (e, data) {
 	        	var info = data.result.content;
	 	        if(data.result.error == 0)
	 	        {
		 	        var path = info.path + "yf_" + info.savename;
			 	    $(this).parent().find('img').attr('src', path);
				 	$(this).parent().find('.yf-img-value').val(path);
	 	        }
	 	        else
	 	        {
	 	        	$.tipMessage(info, 2, 3000);
			 	    //$(this).parent().find('img').attr('src', '/static/images/icon/upload-pic2.png');
	 	        	$(this).parent().find('img').attr('src', old_img);
	 	        }
 	        }
 	    });
		
	    $('.yf_update').click(function(){
	        var title = $(this).attr('data-title');
	        var url = $(this).attr('data-url');
	        yf_file_star($(this), title, url);
	    });

	/*    $('.yf-img-move').hover(function(){
		    $(this).find('.yf-move-window').show();
		}, function(){
			$(this).find('.yf-move-window').hide();
		});*/

		$('.yf-mainpic').on({ 
		    mouseenter: function() { 
		    	$(this).find('.yf-move-window').show();
		    }, 
		    mouseleave: function() { 
		    	$(this).find('.yf-move-window').hide();
		    }
		}, '.yf-img-move');

		$('.yf-mainpic').on('click', '.yf-move-del', function(){
			$(this).parent().remove();
		});
	});
</script>

</body>
</html>